package com.hnevc.yourhealthmanager.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnevc.yourhealthmanager.dao.FoodMetaMapper;
import com.hnevc.yourhealthmanager.entity.FoodMeta;
import com.hnevc.yourhealthmanager.entity.FoodMeta;
import com.hnevc.yourhealthmanager.dao.FoodMetaMapper;
import com.hnevc.yourhealthmanager.service.FoodMetaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FoodMetaServiceImpl extends ServiceImpl<FoodMetaMapper, FoodMeta> implements FoodMetaService {
    @Autowired
    FoodMetaMapper foodMetaMapper;
    @Override
    public FoodMeta updatePic(Integer id, String filePath) {
        FoodMeta foodMeta= foodMetaMapper.selectById(id);
        foodMeta.setFoodImage(filePath);
        if(foodMetaMapper.updateById(foodMeta)>0){
            return foodMeta;
        }else{
            return null;
        }
    }
}
